<template>
  <div>
    <span v-for="(val, index) in list" :key="index">
      <input v-model="newarr" :value="val" type="checkbox" />
      <span>{{ val }}</span>
    </span>
    <p>你选中的元素和为{{ isAll }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      newarr: [],
    };
  },
  computed: {
    isAll: {
      set() {
        return;
      },
      get() {
        // 累计和
        return this.newarr.reduce((sum, val) => (sum += val), 0);
      },
    },
  },
};
</script>

<style>
</style>